<div class="container">
  <ol class="breadcrumb">
    <li><%= link_to 'Home', root_path %></li>
    <li><%= link_to 'Requests', requests_path %></li>
    <li class="active">New request</li>
  </ol>
</div>

<div class="container">
  <h1>Create a new request</h1>

  <%= render 'form' %>

  <br/>


  <h1>
    Listing organizations
  </h1>

  <% if @orgs.empty? %>
      <p>

      <div class="alert alert-warning">
        Currently no organization are created with the system.
      </div>
      </p>
  <% else %>
      <div class="media">
        <table class="table table-hover">

          <thead>
          <tr>
            <th>#</th>
            <th>Title</th>
            <th>Detail</th>
            <th colspan="3"></th>
          </tr>
          </thead>

          <tbody>
          <% i = 1 %>
          <% @orgs.each do |org| %>
              <tr>
                <td><%= i %></td>
                <td><%= org.title %></td>
                <td><%= org.detail %></td>

                <% if session[:org_id] == org.id.to_s %>

                    <td><%= 'Logged-in' %></td>

                <% else %>
                    <td><%= link_to 'Send request', new_org_request_path(org.id), :method => :post %></td>
                <% end %>
              </tr>
          <% end %>
          <% i = i + 1 %>

          </tbody>
        </table>
      </div>
  <% end %>

</div>
